<script lang="ts" setup>
import { useLayoutMode } from "@@/composables/useLayoutMode"

interface Props {
  collapse?: boolean
}

const { collapse = true } = defineProps<Props>()

const { isLeft: _isLeft, isTop } = useLayoutMode()
</script>

<template>
  <div class="layout-logo-container" :class="{ 'collapse': collapse, 'layout-mode-top': isTop }">
    <transition name="layout-logo-fade">
      <router-link v-if="collapse" key="collapse" to="/">
        <img src="/pocket-ai-logo.png" class="layout-logo">
      </router-link>
      <router-link v-else key="expand" to="/" class="layout-logo-container-expand">
        <img src="/pocket-ai-logo.png" class="layout-logo-text">
        <div class="layout-logo-text-expand">
          <p class="layout-logo-title">分销管理系统</p>
          <p class="layout-logo-content">Pocket Ai 后台管理</p>
        </div>
      </router-link>
    </transition>
  </div>
</template>

<style lang="scss" scoped>
.layout-logo-container {
  position: relative;
  width: 100%;
  height: var(--v3-header-height);
  line-height: var(--v3-header-height);
  text-align: center;
  overflow: hidden;
  border-bottom: 1px solid var(--v3-border-color);
  margin-bottom: 10px;
  .layout-logo {
    display: none;
  }

  .layout-logo-container-expand {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    height: 100%;
    gap: 20px;
    .layout-logo-text {
      width: 40px;
      height: 40px;
      vertical-align: middle;
    }
    .layout-logo-text-expand {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 10px;
      height: 100%;
      p {
        line-height: 100%;
        margin: 0;
        font-size: 12px;
      }
      .layout-logo-title {
        font-size: 16px;
        font-weight: 600;
      }
    }
  }
}

.layout-mode-top {
  height: var(--v3-navigationbar-height);
  line-height: var(--v3-navigationbar-height);
}

.collapse {
  .layout-logo {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    display: inline-block;
  }
  .layout-logo-text {
    display: none;
  }
}
</style>
